package com.cebbank.yyi.springbootapp.jingtang.service.impl;

import com.cebbank.yyi.springbootapp.jingtang.entity.RcDocProduction;
import com.cebbank.yyi.springbootapp.jingtang.dao.RcDocProductionDao;
import com.cebbank.yyi.springbootapp.jingtang.service.RcDocProductionService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 生产技术文件(RcDocProduction)表服务实现类
 *
 * @author makejava
 * @since 2024-08-22 10:34:43
 */
@Service("rcDocProductionService")
public class RcDocProductionServiceImpl implements RcDocProductionService {
    @Resource
    private RcDocProductionDao rcDocProductionDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public RcDocProduction queryById(String id) {
        return this.rcDocProductionDao.queryById(id);
    }

//    /**
//     * 分页查询
//     *
//     * @param rcDocProduction 筛选条件
//     * @param pageRequest      分页对象
//     * @return 查询结果
//     */
//    @Override
//    public Page<RcDocProduction> queryByPage(RcDocProduction rcDocProduction, PageRequest pageRequest) {
//        long total = this.rcDocProductionDao.count(rcDocProduction);
//        return new PageImpl<>(this.rcDocProductionDao.queryAllByLimit(rcDocProduction, pageRequest), pageRequest, total);
//    }

    /**
     * 新增数据
     *
     * @param rcDocProduction 实例对象
     * @return 实例对象
     */
    @Override
    public RcDocProduction insert(RcDocProduction rcDocProduction) {
        this.rcDocProductionDao.insert(rcDocProduction);
        return rcDocProduction;
    }

    /**
     * 修改数据
     *
     * @param rcDocProduction 实例对象
     * @return 实例对象
     */
    @Override
    public RcDocProduction update(RcDocProduction rcDocProduction) {
        this.rcDocProductionDao.update(rcDocProduction);
        return this.queryById(rcDocProduction.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(String id) {
        return this.rcDocProductionDao.deleteById(id) > 0;
    }
}
